package com.fanjun.learning.multithread.Activity_Object_Pattern;

/**
 * 仆人类,实际的request调用者\执行者
 */
public class Servant implements ActivityObject{
    public Result makeString(int count, char fillChar) {
        char[] buffer = new char[count];
        for (int i = 0; i < count; i++){
            buffer[i] = fillChar;
            try {
                Thread.sleep(10);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        return new RealResult(new String(buffer));
    }

    public void displayString(String value) {
        System.out.println("Display String : " + value);
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
